#include "Item.h"

Item::Item()
	:GameObject()
{

}

Item::Item(int id, float posX, float posY, int width, int height, GameObID kind)
	: GameObject(id, posX, posY, width, height)
{
	setGameObID(kind);
	m_posYDefault = m_posY;
	init();
}

Item::~Item()
{

}

void Item::init()
{
	m_sprite = ResourceManager::getInstance()->cS_item;
}

void Item::update(float time)
{
	/*updateVec(time);
	moveEnity();*/
	if (m_camera->getPosX() > m_posX)
	{
		isRun(true);
	}

	if (isRun())
	{
		m_timeCounter += time;
		m_posY = m_posYDefault + 10 * (cos(m_timeCounter * 45));
		m_vecX = 2;
		m_posX += 2;
		setAnimation();
		setRectCollsion();
	}
}

void Item::setAnimation()
{

}

void Item::setRectCollsion()
{

}

void Item::draw()
{
	if (isRun())
	{
		m_sprite->update();
		D3DXVECTOR2 pos = m_camera->getPointTransform(m_posX, m_posY);
		m_sprite->draw(m_spriteHandler, pos.x, pos.y, false);
	}
}

void Item::destroy()
{
}
